#include "initwindows.h"
#include "ui_initwindows.h"

InitWindows::InitWindows(QWidget *parent) :
    QDialog(parent),
    ui(new Ui::InitWindows)
{
    ui->setupUi(this);

    // 向下拉菜单中加入数字
    for(int i = 30; i <= 40; ++i){
        ui->comboBox->addItem(QString::number(i));
    }
}

InitWindows::~InitWindows()
{
    delete ui;
}

void InitWindows::on_pushButton_clicked()
{
    QString classID = ui->lineEdit->text();
    int numOfStu = ui->comboBox->currentText().toInt();
    if(classID == nullptr || numOfStu < 0){
        QMessageBox::warning(this, "注意", "请确保输入了正确的信息");
        return ;
    }

    m_MainWindow = new MainWindow(classID, numOfStu);
    m_MainWindow->show();
    this->close();
}
